# here put the import lib
import random

from faker import Faker
from sqlalchemy.exc import IntegrityError

from app.ext import db
from app.models import User,TodoList

fake = Faker()


def fake_user():
    user = User(
                username='admin',
                password='123456')
    db.session.add(user)
    db.session.commit()


def fake_todolist(count=50):
    for i in range(count):
        todolist = TodoList(
            title=fake.text(500),
            status= 0,
            user_id = 1,
            create_time=fake.date_time_this_year()
        )
        db.session.add(todolist)
    db.session.commit()